<template>
    <div class="tab_gudong">
        <OverallData :json_data="json_data" />
    </div>
</template>

<script>
import { getCurrentInstance } from 'vue'

export default {
    name: 'TabShidagudong',
    data () {
    return {
        title: '',
        entity: '',
        datas: '',
        json_data: {
            name: '',
            nodes: [],
        },
        message: '',
    };
    },
    setup(){
      const host = getCurrentInstance()?.appContext.config.globalProperties.host
      return {host}
    },
    mounted(){
        var type = this.$route.query.type
        var code = this.$route.query.code
        var name = this.$route.query.name
        //console.log("getDatas:" + url);
        
        var api_url = this.host.concat("/api/get_data?type=").concat(type).concat("&code=").concat(code).concat("&name=").concat(name);
        this.axios.get(api_url)
            .then(response => {
            if((response.status == 200) && (response.data.result == 0)){
                this.datas = response.data.data;
                this.json_data = JSON.parse(response.data.data);
                this.entity = this.json_data.name;
                this.title = this.json_data.name;
            }
        })
        .catch(error => alert(error));

        this.message = '';
    }
}
</script>